package com.woniu.job.util;

import lombok.Data;

@Data
public class ResponseEntity<T> {
    private int code;// 参考HTTP的状态码（200,404,500,403，...）
    private boolean result; // true：成功；false：错误
    private String message; // 描述信息，可以直接在前端使用
    private T data; // 数据

    public ResponseEntity(int code, boolean result, String message, T carts) {
        this.code = code;
        this.result = result;
        this.message = message;
        this.data = carts;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public boolean isResult() {
        return result;
    }

    public void setResult(boolean result) {
        this.result = result;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public ResponseEntity() {

    }

    public ResponseEntity(T data) {
        this.code = 200;
        this.result = true;
        this.message = "";
        this.data = data;
    }

    public static final ResponseEntity<?> SUC = new ResponseEntity<>(null);
}